package com.cashmama.market.api.infras.enums.message;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: market-api
 * @description
 * @author: frank
 * @create: 2019-12-20 12:05
 **/
public enum VerifyCodeTypeEnum {

    VERIFY_TYPE_REGISTER(1, "register", "Your one time password for activating your app account is {0}"),
    VERIFY_TYPE_LOGIN(2, "login", "Your one time OPT for login your app is {0}"),
    VERIFY_TYPE_FORGET_PASSWORD(3, "forgetPassword", "Your one time OPT for reset your password is {0}"),
    VERIFY_TYPE_UPDATE_PASSWORD(4, "updatePassword", "Your one time OPT for reset your password is：{0}"),
    VERIFY_TYPE_BIND_DEVICE(5, "bindDevice", "Your one time OPT for binding your device is：{0}"),
    VERIFY_TYPE_SELF_SIGN(6, "sign", "Your one time OPT for binding your device is：{0}"), // 自己的签约
    VERIFY_TYPE_ADVANCE_IDENTITY_CHECK(7, "cardNo", "advanceIdentityCheck"),//aadhaar
    ;

    private Integer type;
    private String name;
    private String desc;

    VerifyCodeTypeEnum(Integer type, String name, String desc) {
        this.type = type;
        this.name = name;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public VerifyCodeTypeEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getName() {
        return name;
    }

    public VerifyCodeTypeEnum setName(String name) {
        this.name = name;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public VerifyCodeTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static List<String> getNameList() {
        List<String> list = new ArrayList<>();
        for (VerifyCodeTypeEnum enumObj : VerifyCodeTypeEnum.values()) {
            list.add(enumObj.getName());
        }
        return list;
    }

    public static VerifyCodeTypeEnum getEnumByType(Integer type) {
        VerifyCodeTypeEnum VerifyCodeTypeEnum = null;
        for (VerifyCodeTypeEnum enumObj : VerifyCodeTypeEnum.values()) {
            if (enumObj.getType().equals(type)) {
                VerifyCodeTypeEnum = enumObj;
                break;
            }
        }

        return VerifyCodeTypeEnum;
    }

    public static VerifyCodeTypeEnum getEnumByName(String name) {
        VerifyCodeTypeEnum VerifyCodeTypeEnum = null;
        for (VerifyCodeTypeEnum enumObj : VerifyCodeTypeEnum.values()) {
            if (enumObj.getName().equals(name)) {
                VerifyCodeTypeEnum = enumObj;
                break;
            }
        }
        return VerifyCodeTypeEnum;
    }
}
